<?php
$auth = $_SESSION['auth'];
if($auth<90)
{
	echo '<center>Non hai l\'autorizzazione per accedere a questa pagina.<br><br><img src="images/accesso_negato.gif"></center>';
	exit();
}
//connessione al database
include 'connect.php';
?>

<div id="wrapper">
    	<div id="secWrapper">
        	<div id="container" class="clearfix">
            	<div id="mainCol" class="clearfix">
				    
		<h3 id="why">Gestione Farmacia - Scarico Farmaco</h3><br>
                   
		<font size="2">
		
	<table width="90%" border="1" cellpadding="5" cellspacing="0">
	<tr><th style='padding:5px' align='center'>Descrizione:</th><th style='padding:5px' align='center'>Quantita'</th><th style='padding:5px' align='center'>Scadenza</th><th style='padding:5px' align='center'>Note</th><th></th></tr>
		<?php
		$farmaci = mysql_query("select * from farmacia");
		while($farmaci2 = mysql_fetch_array($farmaci))
		{?>
		<tr>
			<td style='padding:5px' align='center'><?php echo $farmaci2['descrizione']; ?></td>
			<td style='padding:5px' align='center'><?php echo $farmaci2['quantita']; ?></td>
			<td style='padding:5px' align='center'><?php if($farmaci2['scadenza'] != "0000-00-00") echo date("d-m-Y", strtotime ($farmaci2['scadenza'])); ?></td>
			<td style='padding:5px' align='center'><?php echo $farmaci2['note']; ?></td>
			<td style='padding:5px' align='center'><a href="javascript:validateForm(<?php echo$farmaci2['id']; ?>);">scarico</a></td>
		</tr>
		<?php
		}
		?>
	</table>
	
	<a href="home.php?page=farmacia">Indietro</a>
	
		</font>
                </div>
		
<script language="Javascript">

function validateForm(id) 
	{
		
		if (confirm("Operazione non reversibile, continuare?")) 
		{
			browser= navigator.appName;
			if (browser == "Netscape")
			window.location="scaricofarmaco2.php?id="+id; else window.location="scaricofarmaco2.php?id="+id;
		}	
	}
</script>
                